package com.ffcs.cn.action.common;

import java.util.HashSet;

/**
 * 统一控制图层设置参数面板切换的类
 *
  */
public class StyleSettingPanelManager extends HashSet<AbstractStyleSettingPanel> {
	private AbstractStyleSettingPanel activePanel;

	/**
	 * 设置当前展示的面板
	 *
	 * @param abstractStyleSettingPanel 图层设置面板
	 */
	public void setActivePanel(AbstractStyleSettingPanel abstractStyleSettingPanel) {
		for (AbstractStyleSettingPanel styleSettingPanel : this) {
			if (styleSettingPanel == abstractStyleSettingPanel) {
				activePanel = styleSettingPanel;
				styleSettingPanel.setVisible(true);
			} else {
				styleSettingPanel.setVisible(false);
			}
		}
		if (activePanel == null) {
			this.add(abstractStyleSettingPanel);
			activePanel = abstractStyleSettingPanel;
		}
	}

	/**
	 * 获取当前展示的面板
	 *
	 * @return 图层设置面板
	 */
	public AbstractStyleSettingPanel getActivePanel() {
		return activePanel;
	}
}
